Add vec explicit conversion#669
Merged
Pennycook merged 1 commit intoKhronosGroup:mainfrom Mar 21, 2025
Merged
Conversation
This is change 2 of 9 that fix problems with the specification of the
`vec` class. An implementation that follows the existing specification
would not accept common code patterns and would not pass the CTS. None
of the existing implementations actually follow the existing
specification.
This change adds an explicit conversion when the `vec` has one element,
allowing a conversion to `T` whenever `DataT` can be explicitly
converted to `T`.
This enables code like the following, where the element type `DataT` is
itself a class:
```
sycl::vec<sycl::half, 1> h1;
int i = static_cast<int>(h1);
if (h1) {}
```
These changes correspond to slides 8 - 9 of the presentation that was
discussed in the WG meetings.
TApplencourt
approved these changes
Feb 6, 2025
tomdeakin
approved these changes
Mar 20, 2025
Contributor
|
WG approved to merge for SYCL 2020. |
Pennycook
added a commit
to Pennycook/SYCL-Docs
that referenced
this pull request
Mar 21, 2025
Cherry pick KhronosGroup#669 from main (cherry picked from commit 58abfc4)
aelovikov-intel
added a commit
to aelovikov-intel/llvm
that referenced
this pull request
Mar 31, 2025
aelovikov-intel
added a commit
to aelovikov-intel/llvm
that referenced
this pull request
Apr 1, 2025
aelovikov-intel
added a commit
to intel/llvm
that referenced
this pull request
Apr 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is change 2 of 9 that fix problems with the specification of the
vecclass. An implementation that follows the existing specification would not accept common code patterns and would not pass the CTS. None of the existing implementations actually follow the existing specification.This change adds an explicit conversion when the
vechas one element, allowing a conversion toTwheneverDataTcan be explicitly converted toT.This enables code like the following, where the element type
DataTis itself a class:These changes correspond to slides 8 - 9 of the presentation that was discussed in the WG meetings.